
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>tomcat优化 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>tomcat优化 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">Tomcat的默认最大并发请求数是多少？当并发量达到什么水平时，应考虑应用服务器集群？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Tomcat默认配置的最大请求数是150。当某个应用拥有250个以上并发的时候，应考虑应用服务器的集群。</div>
          </div>
          <div class="card-source">来源: tomcat最大并发量</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">影响Tomcat实际并发承载能力的关键因素有哪些？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Tomcat的实际并发能力与硬件配置（CPU越多性能越高）和分配给JVM的内存大小有很大关系。更多的内存可以提高性能，但也会加重GC（垃圾回收）的负担。</div>
          </div>
          <div class="card-source">来源: tomcat最大并发量</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">Tomcat默认的HTTP实现采用何种通信模型？它与线程处理请求的关系是怎样的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Tomcat默认采用阻塞式的Socket通信。在这种模型下，每个请求都需要创建一个独立的线程来进行处理。</div>
          </div>
          <div class="card-source">来源: tomcat最大并发量</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在Java中，每开启一个新线程大约会消耗多少JVM内存？这部分内存作何用途？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">在Java中，每开启一个线程需要耗用1MB的JVM内存空间，这部分空间主要用作该线程的线程栈。</div>
          </div>
          <div class="card-source">来源: tomcat最大并发量</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">为什么单纯增大Tomcat的线程池（thread pool）大小不一定能提升系统并发处理能力？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">因为单纯增大线程池虽然在初期可能获得较高的TPS（每秒事务处理量），但会增加系统的平均响应时间（MTT）。长期运行下，可能导致TPS回落、系统假死、内存溢出等问题。线程池大小必须根据硬件和内存等配置来综合设定。</div>
          </div>
          <div class="card-source">来源: tomcat优化</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在高TPS（每秒事务处理量）峰值下，Tomcat系统为什么难以长时间稳定运行？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">因为在峰值TPS时，堆内存的分配速度会远大于垃圾回收的速度。这会导致系统越来越频繁地进行Full GC，造成服务停顿时间变长、请求超时或报错，最终可能因内存耗尽而崩溃（OutOfMemoryError）。</div>
          </div>
          <div class="card-source">来源: tomcat优化</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">在进行系统性能优化时，应该优先优化Tomcat配置还是业务逻辑？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">应优先优化业务逻辑实现。因为系统的性能瓶颈往往更多地出现在业务逻辑处理中，例如频繁的数据库操作、不合理的索引、缓存命中率低或过多的IO操作，优化这些方面通常能获得比单纯优化Tomcat更大的性能提升。</div>
          </div>
          <div class="card-source">来源: tomcat优化</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">操作系统对单个进程的线程数有什么限制？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">文档中提到，操作系统对进程中的线程数有限制，例如：Windows每个进程中的线程数不允许超过2000，Linux每个进程中的线程数不允许超过1000。</div>
          </div>
          <div class="card-source">来源: tomcat最大并发量</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">文档中提到的TPS峰值、线程池大小（ThreadPool）和系统平均响应时间（MTT）之间存在什么样的估算关系？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">文档中给出了一个简单的估算公式：TPS峰值 = ThreadPool / MTT。这表明在线程池大小固定的情况下，响应时间越短，理论上的TPS峰值越高。</div>
          </div>
          <div class="card-source">来源: tomcat优化</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
